package tgc.edu.exam.entity;

import java.io.File;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.Transient;

import org.apache.commons.fileupload.FileItem;
import org.springframework.data.annotation.CreatedBy;

import tgc.edu.exam.custom.BaseEntity;

@Entity
public class Books extends BaseEntity<Integer> {

	
	private String byid;  //编号
	private String filename; //图片名称
	private String uuid; //uuid
	private String title;//书名
	private String suthor; //作者
	private Integer number;//数量
	private String isbn;
	private BookType type;
	
	
	@ManyToOne
	@CreatedBy
	public BookType getType() {
		return type;
	}
	public void setType(BookType type) {
		this.type = type;
	}
	public String getIsbn() {
		return isbn;
	}
	public void setIsbn(String isbn) {
		this.isbn = isbn;
	}
	@Column(unique = true)
	public String getByid() {
		return byid;
	}
	public void setByid(String byid) {
		this.byid = byid;
	}
	public String getFilename() {
		return filename;
	}
	public void setFilename(String filename) {
		this.filename = filename;
	}
	public String getUuid() {
		return uuid;
	}
	public void setUuid(String uuid) {
		this.uuid = uuid;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getSuthor() {
		return suthor;
	}
	public void setSuthor(String suthor) {
		this.suthor = suthor;
	}
	public Integer getNumber() {
		return number;
	}
	public void setNumber(Integer number) {
		this.number = number;
	}
	
	@Transient
	public String getTypeName() {
		return getType()!=null?getType().getType():"";
	}
}
